/**
 * Created by dale on 2017/9/27.
 */
var resInList;
var resOutList;

$(document).ready(function (){
    resInList= $('#resInList');
    resOutList= $('#resOutList');
    $('.xh-datagrid-toolbar').parseToolbar();

    // var resOutEvent=new DataGridEvent();
    resInList.initDataGrid(baseUrl + 'ims/res/getResIn/true',{queryParams:getParams1()});
    resOutList.initDataGrid(baseUrl + 'ims/res/getResOut/true',{queryParams:getParams2()});

    $('#bt_box_search').click(function () {
        resInList.addDataGridParams(getParams1());
    });


    $('#bt_prod_search').click(function () {
        resOutList.addDataGridParams(getParams2());
    });

    resOutList.datagrid({
        onLoadSuccess:function (data) {
            if (data.rows.length > 0) {
                resOutList.mergeCellsByField(['sBoxCode']);
            }
        }
    })



});

function getParams1() {
    var id  = addressUri.getParam('iProdId'),
        key = xhExtra.getValue($('#resIn_search'));
    return {id:id,key:key}
}
function getParams2() {
    var id  = addressUri.getParam('iProdId'),
    key = xhExtra.getValue($('#resOut_search'));
    return {id:id,key:key}
}